package com.csc.yunting.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.csc.yunting.core.mapper.ArtistMapper;
import com.csc.yunting.core.pojo.entity.Artist;
import com.csc.yunting.core.pojo.vo.ArtistVO;
import com.csc.yunting.core.service.ArtistService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 标的出借记录表 服务实现类
 * </p>
 *
 * @author Atguigu
 * @since 2023-03-25
 */
@Service
public class ArtistServiceImpl extends ServiceImpl<ArtistMapper, Artist> implements ArtistService {

    @Override
    public  IPage  findList(ArtistVO artistVO) {
        //1.检查参数
        //分页检查
        artistVO.checkParam();
        //2.分页条件查询
        IPage page = new Page(artistVO.getPage(), artistVO.getSize());

        LambdaQueryWrapper<Artist> lambdaQueryWrapper = new LambdaQueryWrapper();
        //状态精确查询
//        if (dto.getStatus() != null) {
//            lambdaQueryWrapper.eq(WmNews::getStatus, dto.getStatus());
//        }
//
//        //频道精确查询
//        if (dto.getChannelId() != null) {
//            lambdaQueryWrapper.eq(WmNews::getChannelId, dto.getChannelId());
//        }
//
//        //时间范围查询
//        if (dto.getBeginPubDate() != null && dto.getEndPubDate() != null) {
//            lambdaQueryWrapper.between(WmNews::getPublishTime, dto.getBeginPubDate(), dto.getEndPubDate());
//        }
//
//        //关键字的模糊查询
//        if (StringUtils.isNotBlank(dto.getKeyword())) {
//            lambdaQueryWrapper.like(WmNews::getTitle, dto.getKeyword());
//        }
//
//        //查询当前登录人的文章
//        lambdaQueryWrapper.eq(WmNews::getUserId, WmThreadLocalUtil.getUser().getId());
//
//        //按照发布时间倒序查询
//        lambdaQueryWrapper.orderByDesc(WmNews::getPublishTime);


        page = page(page, lambdaQueryWrapper);
        return page;
    }
}
